<?php
/**
 * 年龄检查
 * User: GRAY
 * Date: 16/8/11
 * Time: 下午10:23
 */

namespace Home\Common\Hook;


use Common\Library\BusinessException;
use Common\Library\Constant;
use Common\Vendor\Hook\BaseHook;
use Think\Log;


class Phone extends BaseHook
{

    public function execute($data, $params = [])
        {
            $id_num = $data['id_num'];
            $mobile_pass = $data['mobile_pass'];
            if($mobile_pass==1) {
                return $data;
            }
            $mobile = $data['mobile'];
	    foreach($params["begin_with"] as $row){
		if(strpos($mobile, $row) === 0){
		    BusinessException::throwException(Constant::INVALID_PHONE);
		}
	    }
            return $data;
        }
} 
